local M={}

function M:CreateMainCamera()
    --aniamtor
    local animationRoot=Alice.GameObject.New("A/alien.prefab")
    animationRoot:AttachScript("Scripts.Animator");
    Alice.GameObject.New()
    Alice.Console.Debug("create main camera")
    local go=Alice.GameObject.Find("GameObject")
    if go then
        go:SetName("MainCamera")
        go:AddComponent(Alice.Camera)
        require"Scripts.GameObject"
        log("before attach script")
        local x=go:AttachScript("Scripts.GameObject")
        local s=go:GetScript("Scripts.GameObject")
        self.GameObject:AddChild(go)
        go:AttachScript("Scripts.Camera")
        --go:Call("MethodWithNoArg")
        --go:Call("MethodWithArg",{})
        --Alice.GameObject.Destroy(go)
        --imagesprite
        local is=Alice.GameObject.New()
        is:AddComponent(Alice.ImageSprite)
        is:AttachScript("Scripts.ImageSprite")
        
        local l=Alice.GameObject.New()
        local label=l:AddComponent(Alice.Label)
        l:AttachScript("Scripts.Label")
        
        local as=Alice.GameObject.New()
        as:AddComponent(Alice.AudioSource)
        as:AttachScript("Scripts.AudioSource")
        as:SetName("AudioSourceTest")
        
        local is9=Alice.GameObject.New()
        is9:AddComponent(Alice.ImageSprite9)
        is9:AttachScript("Scripts.ImageSprite9")
    end
end

function M:InitConsole()
    if Alice.RuntimePlatform()=="WinEditor" then
        ReleaseMode=false
    else
        ReleaseMode=true
    end
    require"Scripts.Console"
    log("init console")
end

function M:Awake()
    self:InitConsole()
    Alice.Console.Debug("Driver Awake")
    self:CreateMainCamera()
end

return M